<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>演示申请</title>
<script src="echart/jquery-1.9.1.min.js"></script>
<link rel="stylesheet" href="table/layui/css/layui.css" media="all"/>
<link rel="stylesheet" href="table/css/style.css" media="all"/>
<link rel="stylesheet" type="text/css" href="table/assembly/jqgrid/css/ui.jqgrid.css" />
<link rel="stylesheet" type="text/css" href="table/assembly/jqgrid/css/css/redmond/jquery-ui-1.8.16.custom.css" />
<style type="text/css">
body{ text-align:center} 
#outdiv{margin-left:0px;margin-top: 50px;} 
</style>
</head>
<body>
<form action="ShowApply" method="post">
	<div id="outdiv">
		<div class="layui-row">
			<div class="layui-col-md2">
				<div class="layui-form-item">
					<div class="layui-input-inline">
						<input name="hospital" class="layui-input" type="text" placeholder="请输入演示医院"/>
					</div>
				</div>
			</div>
		</div>
		<div class="layui-row">
			<div class="layui-col-md2">
				<div class="layui-form-item">
					<div class="layui-input-inline">
						<input name="connecter" class="layui-input" type="text" placeholder="请输入医院联系人"/>
					</div>
				</div>
			</div>
		</div>
		<div class="layui-row">
			<div class="layui-col-md2">
				<div class="layui-form-item">
					<div class="layui-input-inline">
						<input name="conmobile" class="layui-input" type="text" placeholder="请输入医院联系人手机号"/>
					</div>
				</div>
			</div>
		</div>
		<div class="layui-row">
			<div class="layui-col-md2">
				<div class="layui-form-item">
					<div class="layui-input-inline">
						<input name="shower" class="layui-input" type="text" placeholder="请输入演示人员姓名"/>
					</div>
				</div>
			</div>
		</div>
		<div class="layui-row">
			<div class="layui-col-md2">
				<div class="layui-form-item">
					<div class="layui-input-inline">
						<input name="shomobile" class="layui-input" type="text" placeholder="请输入演示人员手机号"/>
					</div>
				</div>
			</div>
		</div>
		<div class="layui-row">
			<div class="layui-col-md2">
				<div class="layui-form-item">
					<div class="layui-input-inline">
						<input name="vcode" class="layui-input" type="text" placeholder="请输入验证码"/>
						<input type="button" value="获取验证码" onclick="getvcode();">
					</div>
				</div>
			</div>
		</div>
		<div class="layui-row">
			<div class="layui-col-md2">
				<input type="button"  class="layui-btn" value="提交申请"  onclick="apply();">
			</div>
		</div>
	</div>
</form>
<script type="text/javascript">
function getvcode(){
	var mobile = $("input[name='shomobile']").val();
	if(mobile==null||mobile==''){
		alert("请输入手机号");
		return;
	}
	if(mobile.length!=11){
		alert("请输入正确的手机号");
		return;
	}
	$.post("Vcode",
			{
				mobile:mobile
			}
			,function(data,status){
		        if(status=='success'){
		        	if(data=='success'){
		        		alert("已发送验证码，请注意查收")	
		        	}else{
		        		alert("发送错误，请重试");
		        	}
		        }
    });
	
}
function apply(){
	if($("input[name='hospital']").val()==null){
		alert("请填写演示医院");
		return;
	}
	if($("input[name='shower']").val()==null){
		alert("请填写演示人员姓名");
		return;
	}
	if($("input[name='shomobile']").val()==null){
		alert("请填写演示人员手机号");
		return;
	}
	if($("input[name='shomobile']").val().length!=11){
		alert("请填写正确的演示人员手机号");
		return;
	}
	if($("input[name='vcode']").val()==null){
		alert("请填写验证码");
		return;
	}
	$("form").submit();
}
</script>
</body>
</html>